﻿@{
    Layout = null;
}
<script type="text/javascript">

    // load the submitted but still unhandled items.
    var unhandledstore = new I2R.store.proposals();
    unhandledstore.proxy.extraParams = { proposaltype: 'Unhandled' };
    unhandledstore.load();

    // load the handled but pending items.
    var pendingstore = new I2R.store.proposals();
    pendingstore.proxy.extraParams = { proposaltype: 'Pending' };
    pendingstore.load();

    Ext.widget("proposals", {
        id: 'unhandled-proposals-grid',
        renderTo: 'unhandled-proposals',
        height: '150',
        store: unhandledstore,
        dockedItems: [{
            id: 'unhandled-proposals-grid-pager', 
            xtype: 'pagingtoolbar',
            store: unhandledstore,
            dock: 'bottom',
            displayInfo: true
        }],
        viewConfig: {
            emptyText: '<div class="empty-grid-message">No unhandled deviations.</div>',
            deferEmptyText: false
        }
    });


    Ext.widget("proposals", {
        id: 'pending-proposals-grid',
        height: '150',
        renderTo: 'pending-proposals',
        store: pendingstore,
        dockedItems: [{
            xtype: 'pagingtoolbar',
            id: 'pending-proposals-grid-pager',
            store: pendingstore,
            dock: 'bottom',
            displayInfo: true
        }],
        viewConfig: {
            emptyText: '<div class="empty-grid-message">No pending deviations.</div>',
            deferEmptyText: false
        }
    });

    Ext.create('Ext.Button', {
        action: 'singleproposal',
        text: 'New deviation draft',
        renderTo: 'new-proposal-button',
        iconCls: 'icon_user-add'
    });

    Ext.create('Ext.Button', {
        action: 'groupproposal',
        text: 'New group deviation draft',
        renderTo: 'new-group-proposal-button',
        iconCls: 'icon_group-add'
    });
</script>
<div id="dashboard-content" class="padd-up">
    <h2>Dashboard</h2>
    <div class="left">
        <div class="info">
            <p>
                From here you can send in new deviations and find your latest deviations and where they current are.
            </p>
            <div id="new-proposal-button-container">
                <div class="left">
                    <div id="new-proposal-button"></div>
                </div>
                <div class="left margin20">
                    <div id="new-group-proposal-button"></div>
                </div>
            </div>
        </div>
        <div id="unhandled-proposals-container">
            <h3>Your unhandled deviations</h3>
            <div id="unhandled-proposals"></div>
        </div>        
        <div id="pending-proposals-container">
            <h3>Your pending deviations</h3>
            <div id="pending-proposals"></div>        
        </div>
    </div>
    <div class="left">
        <div id="proposal-statistics">
            <h3>Deviation statistics</h3>
            <div class="chart">
                <img src="../../Scripts/pie1.png" width="268" />
            </div>
            <div class="chart-description">
                <ul>
                    <li>Unhandled X%</li>
                    <li>Pending X%</li>
                    <li>Rejected X%</li>
                    <li>Allowed X%</li>
                    @*<li>Rewarded X%</li>*@
                </ul>
            </div>
        </div>
    </div>
</div>